//@author A0083782W

#include "CurrentTime.h"

CurrentTime::CurrentTime(void) {
	update();
}

void CurrentTime::update() {
	t = time (0);
	localtime_s (&now, &t);
}

ByteInt CurrentTime::getCurrentTime (TimeType thisType) const{

	switch (thisType) {
	case GetCurrentTimeFunctions::TimeType::SECOND:
		return (now.tm_sec);
		break;
	case GetCurrentTimeFunctions::TimeType::MINUTE:
		return (now.tm_min);
		break;
	case GetCurrentTimeFunctions::TimeType::HOUR:
		return (now.tm_hour);
		break;
	case GetCurrentTimeFunctions::TimeType::DAY:
		return (now.tm_mday);
		break;
	case GetCurrentTimeFunctions::TimeType::MONTH:
		return (now.tm_mon + 1);
		break;
	case GetCurrentTimeFunctions::TimeType::YEAR:
		return (now.tm_year + 1900 - 2000);
		break;
	case TimeType::DAYOFWEEK:
		return (now.tm_wday);
		break;
	default:
		return 0;
		break;
	}
}